package com.example.json.galleryfinal;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.graphics.drawable.Drawable;

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

import cn.finalteam.galleryfinal.CoreConfig;
import cn.finalteam.galleryfinal.FunctionConfig;
import cn.finalteam.galleryfinal.GalleryFinal;
import cn.finalteam.galleryfinal.ImageLoader;
import cn.finalteam.galleryfinal.ThemeConfig;
import cn.finalteam.galleryfinal.widget.GFImageView;

/**
 * Created by Json on 2016/11/16.
 */
public class MyApplication extends Application {
    /***************************** com.nostra13 ImageLoader相关变量 ************************************/
    public static Context context;
    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        galleryFinall();
    }
    private void galleryFinall() {
        //设置主题
//ThemeConfig.CYAN
        ThemeConfig theme = new ThemeConfig.Builder()
//                .setTitleBarTextColor(getResources().getColor(R.color.green))//标题栏文本字体颜色
                .setTitleBarBgColor(getResources().getColor(R.color.green))//标题栏背景颜色
//                .setTitleBarIconColor(getResources().getColor(R.color.green))//标题栏icon颜色，如果设置了标题栏icon，设置setTitleBarIconColor将无效
//                .setCheckNornalColor(getResources().getColor(R.color.green))//选择框未选颜色
                .setCheckSelectedColor(getResources().getColor(R.color.green))//选择框选中颜色
                .setCropControlColor(getResources().getColor(R.color.green))//设置裁剪控制点和裁剪框颜色
                .setFabNornalColor(getResources().getColor(R.color.green))//设置Floating按钮Nornal状态颜色
                .setFabPressedColor(getResources().getColor(R.color.green))//设置Floating按钮Pressed状态颜色
                .build();
//配置功能
        FunctionConfig functionConfig = new FunctionConfig.Builder()
                .setEnableCamera(true)
                .setEnableEdit(true)
                .setEnableCrop(true)
                .setEnableRotate(true)
                .setCropSquare(true)
                .setEnablePreview(true)
                .build();
        ImageLoader imageLoader = new UILImageLoader();
        ImageLoaderConfiguration.createDefault(this);
        CoreConfig coreConfig = new CoreConfig.Builder(this, imageLoader, theme)
                .setFunctionConfig(functionConfig)
                .build();
        GalleryFinal.init(coreConfig);
    }
    public static Context getContext() {
        return context;
    }
}
